home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Installer SDK Cornucopia 1.0.2 / Script Examples / Custom UI Example / customUI.r < prev    next >
Encoding:
Text File  |  1996-09-30  |  27.9 KB  |  852 lines  |  [TEXT/MPS ]

  1. //
  2. //    customUI.r    - demonstrates customized User Interface for the Installer
  3. //
  4. //    
  5. //        This example demonstrates usage of the Easy and Custom Frameworks
  6. //        to construct Easy Install and a Custom Install selections.
  7. //
  8. //        Also included are examples to create package comments for all
  9. //        Custom Install packages, Custom Install subpackages, Custom
  10. //        Removal packages, and the method for allowing the user to
  11. //        select the volume and folder as the target for the installation.
  12. //
  13. //        Customizable help screens are implemented.
  14. //        
  15. //        This example also demonstrates how to install custom icons.
  16. //        The folder called "Disk 2" has a custom folder icon.  This icon will
  17. //        be installed into the target folder as part of the "Example File • 1"
  18. //        package.
  19. //        NOTE: As of Installer 4.0.3 the feature allowing the scriptwriter
  20. //        to implement installation of a Custom Icon is broken. The 4.0.3 
  21. //        Installer fails to set the "use Custom Icon" bit in the
  22. //        Finder Attributes flag of the target folder. This bug is fixed in
  23. //        Installer 4.0.6.  An example of installing a custom icon file is included
  24. //        so that when Installer 4.0.6 is released, those who would like to
  25. //        install custom icons will have the necessary information. An 'after'
  26. //        Action Atom can be used to work around this bug for Installer 4.0.3.
  27. //        Contact DTS (email: devsupport@apple.com) for more information.
  28. //
  29. //
  30. //        Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
  31. //
  32.  
  33. #include "InstallerTypes.r"
  34.  
  35. #define kMainPackage    100
  36. #define kDividerPackage    9999
  37.  
  38. // • easy install setup
  39.  
  40. // easy install framework must use an ID other than 765 or 766
  41. // recommended to always use ID 764
  42. resource 'infr' (764) {
  43.     format0 {{
  44.         pickFirst, { 700 },    
  45.     }}
  46. };
  47.  
  48. // rule that adds main package to Easy Install
  49. resource 'inrl' (700) {
  50.     format0 {{
  51.         // add main package and description to Easy Install package list
  52.         AddPackages{{ kMainPackage }},
  53.         AddUserDescription{ "Install three copies of Example File to your hard disk." },
  54.     }}
  55. };
  56.  
  57. // • custom install setup
  58.  
  59. // custom install framework always uses ID of 766
  60. resource 'infr' (766) {
  61.     format0 {{
  62.         pickFirst, { 800 },
  63.     }}
  64. };
  65.  
  66. // rule that adds main package to Custom Install
  67. resource 'inrl' (800) {
  68.     format0 {{
  69.         // add main package to Custom Install package list
  70.         AddCustomItems{{ kMainPackage }},
  71.     }}
  72. };
  73.  
  74.  
  75. // • packages
  76.  
  77. resource 'inpk' ( kMainPackage ) {
  78.     format0 {
  79.         showsOnCustom,            // ignored in packages that are added
  80.                                 // to Custom Install via AddCustomItems
  81.                                 // which places packages in the highest
  82.                                 // level of Custom Install choice list
  83.                                 
  84.         removable,                // show under Custom Remove when item
  85.                                 // added to Custom Install via
  86.                                 // AddCustomItems
  87.                                 
  88.         dontForceRestart,        // don't make user reboot after installation
  89.         
  90.         kMainPackage,            // package comments resource ID
  91.         
  92.         0,                        // package size ( if 0, filled by ScriptCheck )
  93.         
  94.         "Everything",            // Custom Install selection description
  95.         {    
  96.         'inpk', 200;            // a subpackage
  97.         'inpk', 300;            // a subpackage
  98.         'inpk', kDividerPackage;// divider line between subpackages
  99.         'inpk', 400;            // a subpackage
  100.         },
  101.     }
  102. };
  103.  
  104. resource 'inpk' (200) {
  105.     format0 {
  106.         showsOnCustom,            // show the package as a selectable item
  107.                                 // item when used as a subpackage
  108.                                 
  109.         removable,                // show under Custom Remove as a selectable
  110.                                 // item, when package is a subpackage
  111.                                 
  112.         dontForceRestart,        // don't make user reboot after installation
  113.         
  114.         200,                    // package comments resource ID
  115.         
  116.         0,                        // package size ( if 0, filled by ScriptCheck )
  117.         
  118.         "Example File • 1",        // Custom Install selection description
  119.         {    
  120.         'infa', 2000;            // file to install or remove
  121.         'infa', 1966;            // this is our custom icon file
  122.         },
  123.     }
  124. };
  125.  
  126. resource 'inpk' (300) {
  127.     format0 {
  128.         showsOnCustom,            // show the package as a selectable item
  129.                                 // item when used as a subpackage
  130.                                 
  131.         removable,                // show under Custom Remove as a selectable
  132.                                 // item, when package is a subpackage
  133.                                 
  134.         dontForceRestart,        // don't make user reboot after installation
  135.         
  136.         300,                    // package comments resource ID
  137.         
  138.         0,                        // package size ( if 0, filled by ScriptCheck )
  139.         
  140.         "Example File • 2",        // Custom Install selection description
  141.         {    
  142.         'infa', 3000;            // file to install or remove
  143.         },
  144.     }
  145. };
  146.  
  147. resource 'inpk' (400) {
  148.     format0 {
  149.         showsOnCustom,            // show the package as a selectable item
  150.                                 // item when used as a subpackage
  151.                                 
  152.         notRemovable,            // shown under Custom Remove when package
  153.                                 // is a subpackage
  154.                                 // • be sure that this item is not available
  155.                                 // to be selected under Custom Remove
  156.                                 
  157.         dontForceRestart,        // don't make user reboot after installation
  158.         
  159.         400,                    // package comments resource ID
  160.         
  161.         0,                        // package size ( if 0, filled by ScriptCheck )
  162.         
  163.         "Example File • 3",        // Custom Install selection description
  164.         {    
  165.         'infa', 4000;            // file to install or remove
  166.         },
  167.     }
  168. };
  169.  
  170. resource 'inpk' ( kDividerPackage ) {
  171.     format0 {
  172.         showsOnCustom,            // show the divider as package or subpackage
  173.                                 
  174.         notRemovable,            // don't allow divider to be selected 
  175.                                 // under Custom Removal mode
  176.                                 
  177.         dontForceRestart,        // don't make user reboot after removal
  178.         
  179.         0,                        // doesn't need package comments
  180.         
  181.         0,                        // package size is empty
  182.         
  183.         "-",                    // display divider line
  184.         {    
  185.                                 // contents list needs to be empty 
  186.                                 // for divider packages
  187.         },
  188.     }
  189. };
  190.  
  191.  
  192.  
  193. // • package comments
  194.  
  195. // NOTE: The actual file that will be installed by each package is a SimpleText file
  196. // named Example File. The information detailed below does not actually correspond to 
  197. // the file being installed and is intended only as an example of how to 
  198. // prepare custom package information resources.
  199.  
  200. // FURTHER NOTE: The values that are assigned to the Custom Package Information 
  201. // resource fields do not actually have any effect on the installation and 
  202. // are ignored during installation. They can however assist the user in 
  203. // choosing which packages they would like to include in their Custom 
  204. // Installation or Custom Removal.
  205.  
  206. // The following included file contains the icons for the two package comments.
  207. // The file was created by opening the application to be installed within ResEdit.
  208. // The'ICN#', 'icl4' and 'icl8' icon resources were then copied into a new
  209. // ResEdit file called "Icons.rsrc" and assigned the resource items an ID of 9128,
  210. // since their original resource ID's had a value that was illegal for use with
  211. // 'inpc' resources ( they must be over 1024 ).
  212. // - An alternative to this method is to derez the application and to paste 
  213. // the resulting resource definitions into this script file and to let the 
  214. // Rez command build the icons every time that the Installer script is Rezzed. 
  215. // If you happen to forget to include the resources for the icons, ScriptCheck 
  216. // will complain, but you will still be able to use the Rezzed Installer script 
  217. // to successfully perform an installation. 
  218.  
  219. include "Icons.rsrc";
  220.  
  221. resource 'inpc' ( kMainPackage ) {
  222.     format1 {
  223.         8081994,                // sample date ( 08/08/94 )
  224.         403,                    // sample version ( 4.0.3 )
  225.         
  226.         4500 * 1024,            // RAM required for package ( 4.5 megabytes )
  227.         
  228.         9128,                    // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
  229.                                 // - ID must be greater than 1024
  230.                                 // - resource item is in included rsrc file
  231.                                 
  232.         kMainPackage,            // 'TEXT' resource ID of item  
  233.                                 // containing package description
  234.         
  235.     }
  236. };
  237.  
  238. resource 'inpc' ( 200 ) {
  239.     format1 {
  240.         10011996,                // sample date ( 10/01/96 )
  241.         403,                    // sample version ( 4.0.3 )
  242.         
  243.         3500 * 1024,            // RAM required for package ( 3.5 megabytes )
  244.         
  245.         9128,                    // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
  246.                                 // - ID must be greater than 1024
  247.                                 // - resource item is in included rsrc file
  248.                                 
  249.         200,                    // 'TEXT' resource ID of item  
  250.                                 // containing package description
  251.         
  252.     }
  253. };
  254.  
  255. resource 'inpc' ( 300 ) {
  256.     format1 {
  257.         10011996,                // sample date ( 10/01/96 )
  258.         403,                    // sample version ( 4.0.3 )
  259.         
  260.         4000 * 1024,            // RAM required for package ( 4.0 megabytes )
  261.         
  262.         9128,                    // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
  263.                                 // - ID must be greater than 1024
  264.                                 // - resource item is in included rsrc file
  265.                                 
  266.         300,                    // 'TEXT' resource ID of item  
  267.                                 // containing package description
  268.         
  269.     }
  270. };
  271.  
  272. resource 'inpc' ( 400 ) {
  273.     format1 {
  274.         10011996,                // sample date ( 10/01/96 )
  275.         403,                    // sample version ( 4.0.3 )
  276.         
  277.         4500 * 1024,            // RAM required for package ( 4.5 megabytes )
  278.         
  279.         9128,                    // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
  280.                                 // - ID must be greater than 1024
  281.                                 // - resource item in rezzed script file
  282.                                 
  283.         400,                    // 'TEXT' resource ID of item  
  284.                                 // containing package description
  285.         
  286.     }
  287. };
  288.  
  289.  
  290.  
  291. // The following resource items can easily be created manually by creating 
  292. // 'TEXT' resource items in a ResEdit file and including that file in this 
  293. // script.
  294. // USE: include "<fileWithTextItem>.rsrc";    
  295. // Resource includes use "include" instead of "#include" 
  296. // and are terminated with a semicolon.
  297.  
  298. // NOTE: The new package comment resource ( 'inpc' ) allows descriptions beyond
  299. // the 255 character limit of the old comment resource ( 'icmt' ), by using
  300. // 'TEXT' type resources for the package description field. 'TEXT' type 
  301. // resources are limited to 32K.
  302.  
  303. data 'TEXT' ( kMainPackage ) {
  304.     "This package contains 'Example File • 1', 'Example File • 2' and 'Example File • 3'. "
  305.     "These items will be installed to a user selectable folder during Custom "
  306.     "Install and 'Example File • 1' and 'Example File • 2' will be removed during "
  307.     "Custom Remove. "
  308. };
  309.  
  310. data 'TEXT' ( 200 ) {
  311.     "This package contains 'Example File • 1'. "
  312. };
  313.  
  314. data 'TEXT' ( 300 ) {
  315.     "This package contains 'Example File • 2'. "
  316. };
  317.  
  318. data 'TEXT' ( 400 ) {
  319.     "This package contains 'Example File • 3'. "
  320. };
  321.  
  322.  
  323.  
  324. // • file atoms
  325.  
  326. // file atom for Example File  #1
  327. resource 'infa' (2000) {
  328.     format1 {
  329.         deleteWhenRemoving,            //     Remove during removal
  330.         deleteWhenInstalling,        //     Remove during installation
  331.         copy,                        //  Copy on Install
  332.         dontIgnoreLockedFile,        //     Respect file locking
  333.         dontSetFileLocked,            //    Don't lock installed file
  334.         useSrcCrDateToCompare,        //    Compare using creation date
  335.         srcNeedExist,                //    Make sure file is on install disk
  336.         rsrcForkInRsrcFork,            //     Put resource info in resource fork
  337.         leaveAloneIfNewer,            //  Warn before updating a newer file
  338.         
  339.         updateExisting,                //  Okay to overwrite existing file
  340.         copyIfNewOrUpdate,            //    Okay to install if tgt doesn't exist
  341.         
  342.         rsrcFork,                    //     Include resource fork
  343.         dataFork,                    //     Include data fork
  344.         
  345.         0,                            //    File size ( filled in by ScriptCheck
  346.                                     //    if this value is zero )
  347.                                     
  348.         0x0,                        //     Finder attributes flags ( filled in
  349.                                     //    by ScriptCheck if this value is zero )
  350.         
  351.         10001,                        // Target spec for file
  352.         {    
  353.             10000,                     //     Source spec for file
  354.             
  355.             0,                         //    Source Data fork size ( filled in
  356.                                     //    by ScriptCheck if this value is zero )
  357.  
  358.             0                         //    Source Resource fork size ( filled in
  359.                                     //    by ScriptCheck if this value is zero )
  360.         },
  361.         
  362.         0,                            //  The source version number in BCD format
  363.                                     //  Ignored when comparing by date
  364.                                     
  365.         0,                            //     Version compare procedure ( 0 : none )
  366.         
  367.         0,                            //  Atom extender resource ID ( 0 : none )
  368.         
  369.         "Example File from Disk 1"    
  370.                             //     Use this field if you wish to substitute
  371.                             //    some description for the file being installed
  372.                             //     or removed. If "" is used, then Installer
  373.                             //    will use the filename.
  374.                                     
  375.                             //    NOTE: The Installer will display the filename
  376.                             //    or value entered here after the messages
  377.                             //    "Reading < file description >…"
  378.                             //    "Writing < file description >…", etc.
  379.     }
  380. };
  381.  
  382. // file atom for Example File #2
  383. resource 'infa' (3000) {
  384.     format1 {
  385.         deleteWhenRemoving,            //     Remove during removal
  386.         deleteWhenInstalling,        //     Remove during installation
  387.         copy,                        //  Copy on Install
  388.         dontIgnoreLockedFile,        //     Respect file locking
  389.         dontSetFileLocked,            //    Don't lock installed file
  390.         useSrcCrDateToCompare,        //    Compare using creation date
  391.         srcNeedExist,                //    Make sure file is on install disk
  392.         rsrcForkInRsrcFork,            //     Put resource info in resource fork
  393.         leaveAloneIfNewer,            //  Warn before updating a newer file
  394.         
  395.         updateExisting,                //  Okay to overwrite existing file
  396.         copyIfNewOrUpdate,            //    Okay to install if tgt doesn't exist
  397.         
  398.         rsrcFork,                    //     Include resource fork
  399.         dataFork,                    //     Include data fork
  400.         
  401.         0,                            //    File size ( filled in by ScriptCheck
  402.                                     //    if this value is zero )
  403.                                     
  404.         0x0,                        //     Finder attributes flags ( filled in
  405.                                     //    by ScriptCheck if this value is zero )
  406.         
  407.         20001,                        // Target spec for file
  408.         {    
  409.             20000,                     //     Source spec for file
  410.             
  411.             0,                         //    Source Data fork size ( filled in
  412.                                     //    by ScriptCheck if this value is zero )
  413.  
  414.             0                         //    Source Resource fork size ( filled in
  415.                                     //    by ScriptCheck if this value is zero )
  416.         },
  417.         
  418.         0,                            //  The source version number in BCD format
  419.                                     //  Ignored when comparing by date
  420.                                     
  421.         0,                            //     Version compare procedure ( 0 : none )
  422.         
  423.         0,                            //  Atom extender resource ID ( 0 : none )
  424.         
  425.         "Example File from Disk 2"        
  426.                             //     Use this field if you wish to substitute
  427.                             //    some description for the file being installed
  428.                             //     or removed. If "" is used, then Installer
  429.                             //    will use the filename.
  430.                                     
  431.                             //    NOTE: The Installer will display the filename
  432.                             //    or value entered here after the messages
  433.                             //    "Reading < file description >…"
  434.                             //    "Writing < file description >…", etc.
  435.         };
  436. };
  437.  
  438. // file atom for our custom folder icon
  439. resource 'infa' (1966) {
  440.     format1 {
  441.         deleteWhenRemoving,            //     Remove during removal
  442.         deleteWhenInstalling,        //     Remove during installation
  443.         copy,                        //  Copy on Install
  444.         dontIgnoreLockedFile,        //     Respect file locking
  445.         dontSetFileLocked,            //    Don't lock installed file
  446.         useSrcCrDateToCompare,        //    Compare using creation date
  447.         srcNeedExist,                //    Make sure file is on install disk
  448.         rsrcForkInRsrcFork,            //     Put resource info in resource fork
  449.         leaveAloneIfNewer,            //  Warn before updating a newer file
  450.         
  451.         updateExisting,                //  Okay to overwrite existing file
  452.         copyIfNewOrUpdate,            //    Okay to install if tgt doesn't exist
  453.         
  454.         rsrcFork,                    //     Include resource fork
  455.         dataFork,                    //     Include data fork
  456.         
  457.         0,                            //    File size ( filled in by ScriptCheck
  458.                                     //    if this value is zero )
  459.                                     
  460.         0x0,                        //     Finder attributes flags ( filled in
  461.                                     //    by ScriptCheck if this value is zero )
  462.         
  463.         1966,                        // Target spec for file
  464.         {    
  465.             1966,                     //     Source spec for file
  466.             
  467.             0,                         //    Source Data fork size ( filled in
  468.                                     //    by ScriptCheck if this value is zero )
  469.  
  470.             0                         //    Source Resource fork size ( filled in
  471.                                     //    by ScriptCheck if this value is zero )
  472.         },
  473.         
  474.         0,                            //  The source version number in BCD format
  475.                                     //  Ignored when comparing by date
  476.                                     
  477.         0,                            //     Version compare procedure ( 0 : none )
  478.         
  479.         0,                            //  Atom extender resource ID ( 0 : none )
  480.         
  481.         "custom icon file"        
  482.                             //     Use this field if you wish to substitute
  483.                             //    some description for the file being installed
  484.                             //     or removed. If "" is used, then Installer
  485.                             //    will use the filename.
  486.                                     
  487.                             //    NOTE: The Installer will display the filename
  488.                             //    or value entered here after the messages
  489.                             //    "Reading < file description >…"
  490.                             //    "Writing < file description >…", etc.
  491.         };
  492. };
  493.  
  494. // file atom for Example File #3
  495. resource 'infa' (4000) {
  496.     format1 {
  497.         dontDeleteWhenRemoving,        //     Don't remove during removal
  498.         deleteWhenInstalling,        //     Remove during installation
  499.         copy,                        //  Copy on Install
  500.         dontIgnoreLockedFile,        //     Respect file locking
  501.         dontSetFileLocked,            //    Don't lock installed file
  502.         useSrcCrDateToCompare,        //    Compare using creation date
  503.         srcNeedExist,                //    Make sure file is on install disk
  504.         rsrcForkInRsrcFork,            //     Put resource info in resource fork
  505.         leaveAloneIfNewer,            //  Warn before updating a newer file
  506.         
  507.         updateExisting,                //  Okay to overwrite existing file
  508.         copyIfNewOrUpdate,            //    Okay to install if tgt doesn't exist
  509.         
  510.         rsrcFork,                    //     Include resource fork
  511.         dataFork,                    //     Include data fork
  512.         
  513.         0,                            //    File size ( filled in by ScriptCheck
  514.                                     //    if this value is zero )
  515.                                     
  516.         0x0,                        //     Finder attributes flags ( filled in
  517.                                     //    by ScriptCheck if this value is zero )
  518.         
  519.         30001,                        // Target spec for file
  520.         {    
  521.             30000,                     //     Source spec for file
  522.             
  523.             0,                         //    Source Data fork size ( filled in
  524.                                     //    by ScriptCheck if this value is zero )
  525.  
  526.             0                         //    Source Resource fork size ( filled in
  527.                                     //    by ScriptCheck if this value is zero )
  528.         },
  529.         
  530.         0,                            //  The source version number in BCD format
  531.                                     //  Ignored when comparing by date
  532.                                     
  533.         0,                            //     Version compare procedure ( 0 : none )
  534.         
  535.         0,                            //  Atom extender resource ID ( 0 : none )
  536.         
  537.         "Example File from Disk 3"        
  538.                             //     Use this field if you wish to substitute
  539.                             //    some description for the file being installed
  540.                             //     If "" is used, then Installer
  541.                             //    will use the filename.
  542.                                     
  543.                             //    NOTE: The Installer will display the filename
  544.                             //    or value entered here after the messages
  545.                             //    "Reading < file description >…"
  546.                             //    "Writing < file description >…", etc.
  547.         };
  548. };
  549.  
  550.  
  551. // • file specs
  552.  
  553. // target file spec for Example File #1
  554. resource 'intf' (10001) {
  555.     format1 {
  556.         noSearchForFile,         // use default search path
  557.         
  558.         TypeCrMustMatch,         // If this is set to TypeCrMustMatch
  559.                                 // then a file with a different type
  560.                                 // and creator than those specified
  561.                                 // below will not be replaced.
  562.                                 // If this is set to TypeCrNeedNotMatch
  563.                                 // then type and creator of an existing
  564.                                 // target file are ignored.
  565.         
  566.         // The Type and Creator fields will be used to set the
  567.         // file's Type and Creator when a new file is created. 
  568.         'ttro',                 // TYPE for new file
  569.         'ttxt',                 // CREATOR for new file
  570.         
  571.         0,                         // finder attribute flags
  572.                                 // filled by ScriptCheck is value is 0
  573.         
  574.         1,                          // creation date for new file
  575.         1,                          // modification date for new file
  576.                                 // NOTE: DATE values are filled
  577.                                 // by ScriptCheck if the value is 1
  578.                                             
  579.         0,                         // search proc ID ( 'insp' ), none used
  580.         
  581.         "folder-user:Example File • 1"        // path to target file
  582.         }
  583.     };
  584.  
  585.  
  586. // source file spec for Example File #1
  587. resource 'infs' (10000) {
  588.     'ttro',                        // TYPE for source file
  589.     'ttxt',                        // CREATOR for source file
  590.     0x1,                        // creation DATE for source file
  591.     noSearchForFile,            // IGNORED in Installer 4.0.x
  592.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  593.     "Disk 1:Example File • 1"        // PATH to source file        
  594. };
  595.  
  596. // target file spec for Example File #2
  597. resource 'intf' (20001) {
  598.     format1 {
  599.         noSearchForFile,         // use default search path
  600.         
  601.         TypeCrMustMatch,         // If this is set to TypeCrMustMatch
  602.                                 // then a file with a different type
  603.                                 // and creator than those specified
  604.                                 // below will not be replaced.
  605.                                 // If this is set to TypeCrNeedNotMatch
  606.                                 // then type and creator of an existing
  607.                                 // target file are ignored.
  608.         
  609.         // The Type and Creator fields will be used to set the
  610.         // file's Type and Creator when a new file is created. 
  611.         'ttro',                 // TYPE for new file
  612.         'ttxt',                 // CREATOR for new file
  613.         
  614.         0,                         // finder attribute flags
  615.                                 // filled by ScriptCheck is value is 0
  616.         
  617.         1,                          // creation date for new file
  618.         1,                          // modification date for new file
  619.                                 // NOTE: DATE values are filled
  620.                                 // by ScriptCheck if the value is 1
  621.                                             
  622.         0,                         // search proc ID ( 'insp' ), none used
  623.         
  624.         "folder-user:Example File • 2"        // path to target file
  625.         }
  626.     };
  627.  
  628. // source file spec for Example File #2
  629. resource 'infs' (20000) {
  630.     'ttro',                        // TYPE for source file
  631.     'ttxt',                        // CREATOR for source file
  632.     0x1,                        // creation DATE for source file
  633.     noSearchForFile,            // IGNORED in Installer 4.0.x
  634.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  635.     "Disk 2:Example File • 2"        // PATH to source file        
  636. };
  637.  
  638. // target file spec for custom folder icon
  639. resource 'intf' (1966) {
  640.     format1 {
  641.         noSearchForFile,         // use default search path
  642.         
  643.         TypeCrMustMatch,         // If this is set to TypeCrMustMatch
  644.                                 // then a file with a different type
  645.                                 // and creator than those specified
  646.                                 // below will not be replaced.
  647.                                 // If this is set to TypeCrNeedNotMatch
  648.                                 // then type and creator of an existing
  649.                                 // target file are ignored.
  650.         
  651.         // The Type and Creator fields will be used to set the
  652.         // file's Type and Creator when a new file is created. 
  653.         '',                 // TYPE for new file.  Custom icons have no type.
  654.         '',                 // CREATOR for new file.  Custom icons have no creator.
  655.         
  656.         0,                         // finder attribute flags
  657.                                 // filled by ScriptCheck is value is 0
  658.         
  659.         0,                          // creation date for new file
  660.         0,                          // modification date for new file
  661.                                 // NOTE: DATE values are filled
  662.                                 // by ScriptCheck if the value is 1
  663.                                             
  664.         0,                         // search proc ID ( 'insp' ), none used
  665.         
  666.         "folder-user:Icon\n"        // path to target file
  667.                                     // NOTE: This name must be used for all custom icon files.
  668.         }
  669.     };
  670.  
  671.  
  672. resource 'infs' (1966) {
  673.         '',             // TYPE for new file.  Custom icons have no type.
  674.         '',             // CREATOR for new file.  Custom icons have no creator.
  675.     0x1,                        // creation DATE for source file
  676.     noSearchForFile,            // IGNORED in Installer 4.0.x
  677.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  678.     "Disk 2:Icon\n"        // PATH to source file        
  679.                         // NOTE: This name must be used for all custom icon files.
  680. };
  681.  
  682. // target file spec for Example File #3
  683. resource 'intf' (30001) {
  684.     format1 {
  685.         noSearchForFile,         // use default search path
  686.         
  687.         TypeCrMustMatch,         // If this is set to TypeCrMustMatch
  688.                                 // then a file with a different type
  689.                                 // and creator than those specified
  690.                                 // below will not be replaced.
  691.                                 // If this is set to TypeCrNeedNotMatch
  692.                                 // then type and creator of an existing
  693.                                 // target file are ignored.
  694.         
  695.         // The Type and Creator fields will be used to set the
  696.         // file's Type and Creator when a new file is created. 
  697.         'ttro',                 // TYPE for new file
  698.         'ttxt',                 // CREATOR for new file
  699.         
  700.         0,                         // finder attribute flags
  701.                                 // filled by ScriptCheck is value is 0
  702.         
  703.         1,                          // creation date for new file
  704.         1,                          // modification date for new file
  705.                                 // NOTE: DATE values are filled
  706.                                 // by ScriptCheck if the value is 1
  707.                                             
  708.         0,                         // search proc ID ( 'insp' ), none used
  709.         
  710.         "folder-user:Example File • 3"    // path to target file
  711.         }
  712.     };
  713.  
  714. // source file spec for Example File #3
  715. resource 'infs' (30000) {
  716.     'ttro',                        // TYPE for source file
  717.     'ttxt',                        // CREATOR for source file
  718.     0x1,                        // creation DATE for source file
  719.     noSearchForFile,            // IGNORED in Installer 4.0.x
  720.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  721.     "Disk 3:Example File • 3"        // PATH to source file        
  722. };
  723.  
  724. // • Installer prefs resource
  725.  
  726. include "HelpPicts.rsrc";
  727.  
  728. resource 'inpr' ( 300 ) {
  729.     format0{
  730.         useFolderTargetMode,    // allow user to select target folder
  731.                                 // instead of only choosing target volume
  732.                                         
  733.         dontAllowUserToSetSystemDisk,    
  734.                                 // don't allow user to override default
  735.                                 // volume as destination for system files
  736.                                         
  737.         showSelectedSizeInCustom,
  738.                                 // show user how much disk space will be
  739.                                 // required for installation of selected files
  740.                                         
  741.         noSetupFunctionSupplied,// not using a setup function code resource
  742.         
  743.         dontAllowCleanInstall,    // Reserved for use by Apple System Software
  744.                                 // Installer scripts.  Should always be
  745.                                 // dontAllowCleanInstall.
  746.                                         
  747.         dontAllowServerAsTarget,// don't allow user to install to 
  748.                                 // an Apple Share volume or server
  749.                                 // See warnings in Installer Tech. Guide about
  750.                                 // using allowServerAsTarget.
  751.     
  752.         '',            // setup function type ( none supplied )
  753.         0,            // setup function code rsrc ID ( none supplied )
  754.         
  755.                     // NOTE: The setup function feature allows
  756.                     // you to select the default target volume and
  757.                     // default target folder from within a code rsrc. 
  758.                     // This feature is only available when 
  759.                     // 'setupFunctionSupplied' is specified.
  760.                                         
  761.                     // If 'useFolderTargetMode' then the setup function
  762.                     // can set the default target volume and default target
  763.                     // folder. If 'useDiskTargetMode' is specified then
  764.                     // the setup function can only set the default target
  765.                     // volume.
  766.                                         
  767.                     // See the "Setup Function Example" for a
  768.                     // demonstration of how to implement a setup
  769.                     // function in your Installer script.
  770.                                         
  771.         {
  772.         // NOTE: In the examples below, all the PICT's are actually 8-bit 
  773.         // grayscale images. This was done for sake of simplicity, since
  774.         // these images are suitable for display in either monochrome or 
  775.         // color and reduce the number of images that needed to be included
  776.         // for this example.
  777.             
  778.         // • Help PICT's in General
  779.             
  780.         // - On any given screen, when the Installer Help Dialog is open
  781.         // there will be two PICT's displayed. One PICT which is tall and thin
  782.         // is displayed on the left is intended to contain some kind of graphic.
  783.         // The other PICT which is wide and short, is displayed on the right, and
  784.         // is intended to contain text imbedded in a PICT.
  785.             
  786.         // - If the screen that the Help Dialog is displayed on is a monochrome
  787.         // screen, then the first pair of PICT's will be displayed for the 
  788.         // current page of the Installer Help.
  789.         
  790.         // - If the screen that the Help Dialog is displayed within is a color
  791.         // screen, then the second pair of PICT's will be displayed for the 
  792.         // current page of the Installer Help.
  793.             
  794.         // - As the user clicks in the PREVIOUS and NEXT buttons that appear
  795.         // in the Help Dialog, the pages will be advanced according to the
  796.         // order that the sets of PICT's are defined below.
  797.         
  798.         // - When the Installer draws the PICT's in the Help Dialog, no resizing
  799.         // is preformed. This means that everything too large to fit into the
  800.         // Help Dialog will be clipped to the size of the window and will be  
  801.         // invisible to the user.
  802.             
  803.         // • the help PICT resources that come with the Apple Installer 4.0
  804.             
  805.         // - These resources are actually in the Installer app itself and will
  806.         // automatically appear when the HELP button is pressed in the Installer
  807.         // if the 'inpr' is defined as it is below for help pages #1 and #2
  808.             
  809.             // help page #1
  810.             
  811.             301,            // B/W graphic section (ID of 'PICT' rsrc)
  812.             311,            // B/W text section (ID of 'PICT' rsrc)
  813.             301,            // 8-Bit Color graphic section (ID of 'PICT' rsrc)
  814.             311,            // 8-Bit Color text section (ID of 'PICT' rsrc)
  815.             
  816.             // help page #2
  817.             302,            // B/W graphic section (ID of 'PICT' rsrc)
  818.             312,            // B/W text section (ID of 'PICT' rsrc)
  819.             302,            // 8-Bit Color graphic section (ID of 'PICT' rsrc)
  820.             312,            // 8-Bit Color text section (ID of 'PICT' rsrc)
  821.             
  822.         // • some customized help PICT resources added for this example
  823.             
  824.         // - the PICT resources listed below were created in graphics program
  825.         // by copying the PICT's out of the Installer application, and then
  826.         // pasting them into a graphics application. The original PICT images
  827.         // were modified ( being careful to keep the items the exact same size )
  828.         // and then pasted into a file called "HelpPicts.rsrc". This file was 
  829.         // then included in the Installer script immediately above the beginning
  830.         // of the definition of this 'inpr' resource.
  831.             
  832.             // help page #3
  833.             9128,            // B/W graphic section (ID of 'PICT' rsrc)
  834.             9129,            // B/W text section (ID of 'PICT' rsrc)
  835.             9128,            // 8-Bit Color graphic section (ID of 'PICT' rsrc)
  836.             9129,            // 8-Bit Color text section (ID of 'PICT' rsrc)m
  837.             
  838.             // etc., continue with additional sets of help pages
  839.         },
  840.         
  841.         "Custom UI Example"            // default target folder name
  842.         
  843.                             // NOTE: This field is only used when
  844.                             // 'useFolderTargetMode' is specified.
  845.                             // This field is ignored when 'useDiskTargetMode'
  846.                             // is specified.
  847.     }
  848.  
  849. };
  850.  
  851.  
  852.